﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using HRMSys.DAL;

namespace HRMSys.UI.SystemMgr
{
    /// <summary>
    /// SettingUI.xaml 的交互逻辑
    /// </summary>
    public partial class SettingUI : Window
    {
        public SettingUI()
        {
            InitializeComponent();
        }

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            SettingDAL dal = new SettingDAL();
            txtCompanyName.Text = dal.GetStringValue("公司名称");
            txtCompanySite.Text = dal.GetStringValue("公司网址");
            txtEmployeeNumberPrefix.Text = dal.GetStringValue("工号前缀");
        }

        private void btnSave_Click(object sender, RoutedEventArgs e)
        {
            SettingDAL dal = new SettingDAL();
            dal.UpdateSetting("公司名称", txtCompanyName.Text);
            dal.UpdateSetting("公司网址", txtCompanySite.Text);
            dal.UpdateSetting("工号前缀", txtEmployeeNumberPrefix.Text);

            DialogResult = true;
        }
    }
}
